import 'package:flutter/material.dart';
import 'package:flutter/services.dart';


class DetailPage extends StatelessWidget {
  int id;
  String name;

  DetailPage(this.id, this.name);

  final SystemUiOverlayStyle _style = SystemUiOverlayStyle(statusBarColor: Colors.transparent);
  @override
  Widget build(BuildContext context) {
    SystemChrome.setSystemUIOverlayStyle(_style);
    // TODO: implement build
    return DetailStatefulWidget(id,name);
  }
}

class DetailStatefulWidget extends StatefulWidget {
  int id;
  String name;

  DetailStatefulWidget(this.id, this.name);

  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _DetailState(id,name);
  }
}

class _DetailState extends State<StatefulWidget> {
  int id;
  String name;

  _DetailState(this.id, this.name);

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text("Detail Page"),
      ),
      body: Center(
        child: Column(
          children: <Widget>[
            Text(id.toString()),
            Text(name.toString()),
            FlatButton(
              child: Text("返回"),
              onPressed: (){
                Navigator.pop(context,"详情页返回数据：" + name);
              },
            )
          ],
        ),
      ),
    );
  }
}